package jtk.project4.fleet.ibatis.dao;

import java.sql.SQLException;
import java.util.List;

import jtk.project4.fleet.domain.RbLoc;
import jtk.project4.fleet.domain.Vendor;

public class RbLocDao extends IbatisDao{
	public List selectRbLocs() throws SQLException {
		List selectRbLocs = null;
			selectRbLocs =getSqlMap().queryForList("SELECT_ALL_RBLOC", null);
		return selectRbLocs;
	}
	
	public RbLoc insertRbLoc(RbLoc rbLoc) throws SQLException{
		return (RbLoc) getSqlMap().insert("INSERT_RBLOC",rbLoc);
	}
	
	public int deleteRbloc(RbLoc rbLoc) throws SQLException{
		return (int) getSqlMap().delete("DELETE_RBLOC", rbLoc);
	}
	
	public int updateRbloc(RbLoc rbLoc) throws SQLException{
		return (int) getSqlMap().update("UPDATE_RBLOC", rbLoc);
	}
	
	public static void main (String args[]) throws SQLException
	{
		RbLoc rbloc;
		List <RbLoc> RbLocs;
		rbloc = new RbLoc();
		
		/* insert data */
		//rbloc.setLocation("BANDUNG");
		
		//rbloc.setLocId(7)("BANDUNG");
		//new RbLocDao().insertRbLoc(rbloc);
		
		/* delete data */
		//rbloc.setLocId(8);
		rbloc.setLocation("bandung");
		rbloc.setLocId(5);
		//new RbLocDao().deleteRbloc(rbloc);
		new RbLocDao().updateRbloc(rbloc);
		/* SELECT ALL */
		RbLocs = new RbLocDao().selectRbLocs();
		System.out.println(RbLocs.size());
		
		/* UPDATE DATA */
		 
		 

	}
	
	
}
